package mpcc.mpcc.activity.busi_presentation;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import mpcc.mpcc.activity.MPCCActivity;
import mpcc.mpcc.activity.R;
import mpcc.mpcc.base.BaseActivity;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class NewsShowActivity extends BaseActivity {
	private TextView title;
	private TextView author;
	private TextView newsTime;

	private TextView newsContent;
	private ImageView newsImage;
	private Button returnBtn;

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.newsshow);
		title = (TextView) findViewById(R.id.newsTitle);
		author = (TextView) findViewById(R.id.author);
		newsTime = (TextView) findViewById(R.id.newsTime);
		newsContent = (TextView) findViewById(R.id.newsContent);
		newsImage = (ImageView) findViewById(R.id.newsImage);
		returnBtn = (Button) findViewById(R.id.return_btn);
	addChangeActListener(returnBtn,NewsShowActivity.this, NewsListActivity.class);
				
		Bundle bundle = this.getIntent().getExtras();
		ArrayList<String> newsidlist = (ArrayList<String>) bundle
				.getSerializable("newsidlist");

		initalView(newsidlist.get(0));
		
	}

	public void initalView(String newsid) {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
		String requestStr="10100002"+newsid+sdf.format(new Date());
		String title = null, author = null, time = null, newsContent = null;
		int imageUrl = 0;
		if (newsid.equals("1")) {
			title = "a";
			author = "1";
			time = "2010-2-2 05:00:00";
			newsContent = "cdasdas";
			imageUrl = R.drawable.aa;

		}
		this.title.setText(title);
		this.author.setText(author);
		newsTime.setText(time);
		this.newsContent.setText(newsContent);
		newsImage.setImageResource(imageUrl);

	}
}
